package com.only4play.authcenter.constants;

import com.only4play.common.constants.BaseEnum;

import java.util.Optional;

/**
 * @author hinzzz www.hinzzz.cn 157957329@qq.com
 * 2024-03-06
 */
public enum AuthType implements BaseEnum<AuthType> {

  SCAN(1, "扫码"),
  PHONE(2, "手机号"),
  FACE(3, "人脸识别"),
  EMAIL(4, "邮件"),
    ;

  AuthType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<AuthType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(AuthType.class, code));
  }

}
